load("//bazel:ray.bzl", "ray_cc_library")

ray_cc_library(
    name = "scheduling_ids",
    srcs = ["scheduling_ids.cc"],
    hdrs = ["scheduling_ids.h"],
    deps = [
        "//src/ray/common:constants",
        "//src/ray/common:ray_config",
        "//src/ray/util:logging",
        "@boost//:algorithm",
        "@com_google_absl//absl/container:flat_hash_map",
        "@com_google_absl//absl/container:flat_hash_set",
        "@com_google_absl//absl/strings",
        "@com_google_absl//absl/synchronization",
    ],
)

ray_cc_library(
    name = "label_selector",
    srcs = ["label_selector.cc"],
    hdrs = ["label_selector.h"],
    deps = [
        "//src/ray/common:constants",
        "//src/ray/protobuf:common_cc_proto",
        "//src/ray/util:logging",
        "@com_google_absl//absl/container:flat_hash_set",
        "@com_google_absl//absl/strings",
        "@com_google_protobuf//:protobuf",
    ],
)

ray_cc_library(
    name = "fixed_point",
    srcs = ["fixed_point.cc"],
    hdrs = ["fixed_point.h"],
    deps = [
        "//src/ray/common:constants",
    ],
)

ray_cc_library(
    name = "placement_group_util",
    srcs = ["placement_group_util.cc"],
    hdrs = ["placement_group_util.h"],
    deps = [
        ":scheduling_ids",
        "//src/ray/util:logging",
    ],
)

ray_cc_library(
    name = "resource_set",
    srcs = ["resource_set.cc"],
    hdrs = ["resource_set.h"],
    deps = [
        ":fixed_point",
        ":scheduling_ids",
        "@boost//:range",
        "@com_google_absl//absl/container:flat_hash_map",
    ],
)

ray_cc_library(
    name = "cluster_resource_data",
    srcs = ["cluster_resource_data.cc"],
    hdrs = ["cluster_resource_data.h"],
    deps = [
        ":fixed_point",
        ":label_selector",
        ":resource_instance_set",
        ":resource_set",
        ":scheduling_ids",
        "//src/ray/util:logging",
        "@boost//:range",
        "@com_google_absl//absl/container:flat_hash_map",
        "@com_google_absl//absl/time",
    ],
)

ray_cc_library(
    name = "scheduling_class_util",
    srcs = ["scheduling_class_util.cc"],
    hdrs = ["scheduling_class_util.h"],
    deps = [
        ":fallback_strategy",
        ":label_selector",
        ":resource_set",
        "//src/ray/common:function_descriptor",
        "//src/ray/common:runtime_env",
        "//src/ray/protobuf:common_cc_proto",
        "//src/ray/util:logging",
        "@com_google_absl//absl/container:flat_hash_map",
        "@com_google_absl//absl/synchronization",
        "@com_google_protobuf//:protobuf",
    ],
)

ray_cc_library(
    name = "resource_instance_set",
    srcs = ["resource_instance_set.cc"],
    hdrs = ["resource_instance_set.h"],
    deps = [
        ":fixed_point",
        ":placement_group_util",
        ":resource_set",
        ":scheduling_ids",
        "//src/ray/util:container_util",
        "//src/ray/util:logging",
        "@com_google_absl//absl/container:flat_hash_map",
        "@com_google_absl//absl/strings",
    ],
)

ray_cc_library(
    name = "fallback_strategy",
    srcs = ["fallback_strategy.cc"],
    hdrs = ["fallback_strategy.h"],
    deps = [
        ":label_selector",
        "//src/ray/protobuf:common_cc_proto",
        "//src/ray/util:logging",
        "@com_google_absl//absl/hash",
    ],
)
